#include <stdio.h>
#include <string.h>

int main(int argc,char** argv)
{
  int ret;
  FILE* file_1 = fopen("./1.txt","r");
  if(file_1 == NULL)
  {
    perror("fopen is errno\n");
    return -1;
  }
  FILE* file_2 = fopen("./2.txt","w");
  if(file_1 == NULL)
  {
    perror("fopen is errno\n");
    return -1;
  }
  char buf[1024];
  while(!feof(file_1))
  {
    fread(buf,1024,1,file_1);
    fwrite(buf,1024,1,file_2);
    memset(buf,0,sizeof(buf));
  }
  printf("ret = %d\n",ret);

  ret = fclose(file_1);
  if(ret < 0)
  {
    perror("fclose is fail\n");
    return -1;
  }
  ret = fclose(file_2);
  if(ret < 0)
  {
    perror("fclose is fail\n");
    return -1;
  }
  return 0;
}
